<!DOCTYPE html>
<html lang="zh-CN">
@include('base.head')
<body>
@extends('index.base')
@if(session('__Ajax_RedirectFunc_status') == true)
    <div>
        <div class="alert alert-success alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <h3>成功</h3>
            <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
            <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
        </div>
    </div>
@endif
@if(session('__Ajax_RedirectFunc_status') === false)
    <div >
        <div class="alert alert-danger alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <h3>失败</h3>
            <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
            <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
        </div>
    </div>
@endif
<div class="container-fluid">
    <div class="container">
        <div class="row">
            <div class="col-md-12 ">
                <h2>我的订单</h2>
                <hr>
                <div class="panel-body" >
                    <table class="table table-responsive table-condensed table-hover table-striped">
                        <thead>
                        <tr>
                            <th>商品样图</th>
                            <th>商品名称</th>
                            <th>商品介绍</th>
                            <th>下单时间</th>
                            <th>商品价格</th>
                            <th>订单状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($orderData as $data)
                            <tr>
                                <td>
                                    <img style="width: 150px;height: 150px" src="/images/{{$data->goods_image}}">
                                </td>
                                <td><a href="/goodsInfo/{{$data->goods_id}}">{{$data->goods_name}}</a></td>
                                <td>{{$data->goods_info}}</td>
                                <td>{{$data->order_time}}</td>
                                <td>{{$data->goods_price}}元</td>
                                <td>{{$data->status_name}}</td>
                                <td>
                                    @if($data->status_id == 2)
                                    <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#order{{$data->goods_id}}">确认收货</button>
                                    @endif
                                    @if($data->status_id != 2)
                                        <button type="button" class="btn btn-success btn-sm  disabled">已确认收货</button>
                                    @endif
                                    @if($data->status_id == 3)
                                        <button type="button" class="btn btn-info btn-sm " data-toggle="modal" data-target="#eva{{$data->goods_id}}">去评价</button>
                                    @endif
                                    @if($data->status_id != 3)
                                        <button type="button" class="btn btn-info btn-sm disabled">已评价</button>
                                    @endif
                                    <div class="modal fade" id="order{{$data->goods_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                    <h4 class="modal-title" id="myModalLabel2">通知</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <h3 style="text-align: center">确定收货？</h3>
                                                </div>
                                                <div class="modal-footer">
                                                    <form action="/toOrder" method="post">
                                                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                        <input type="hidden" name="order_id" value="{{$data->order_id}}">
                                                    <button type="submit" class="btn btn-sm btn-success">确认收货</button>
                                                    <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">返回</button>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="modal fade" id="eva{{$data->goods_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                    <h4 class="modal-title" id="myModalLabel2">评价</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <form action="/addEva" method="post">
                                                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                        <input type="hidden" name="order_id" value="{{$data->order_id}}">
                                                        <input type="hidden" name="goods_id" value="{{$data->goods_id}}">
                                                        <input type="text" name="evaluate_info" class="form-control" placeholder="评价内容" required autofocus>
                                                </div>
                                                <div class="modal-footer">
                                                        <button type="submit" class="btn btn-sm btn-success">提交评价</button>
                                                        <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">返回</button>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div></td>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>